﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestWCF
{
    class hh
    {
        public float Lat { get; set; }
        public float Lon { get; set; }

        public hh(float lat, float lon)
        {
            this.Lat = lat;
            this.Lon = lon;
        }

    }

    class Program
    {
        static void Main(string[] args)
        {
            ServiceReference1.InfoServiceClient c = new ServiceReference1.InfoServiceClient();
            ServiceReference2.TestInfoServiceClient c2 = new ServiceReference2.TestInfoServiceClient();

        

           // c2.startTest();

            //c2.startTest();
        //    string nid = c.GetID(30.2F, 30.4F);

            //ServiceReference1.StationListItem li = null;
            //String nuid = null;
                
            //    try{
                    
            //        li= c.getNearestVehicle(6, 30.3F, 30.2F);
            //        nuid = c.GetID(23.0F, 32.0F);
            //    }catch
            //        {
            //        }

            //if (li == null)
            //    Console.WriteLine("null");
            //else
            //Console.WriteLine(String.Format("Lat: {0}, lon: {1}", li.Latitude, li.Longiture));

            //if (nuid == null)
            //    Console.WriteLine("Nuid null");

            

            //Console.WriteLine(nuid);

//            string id = c.GetID(40, 23);


      //      c.InsertNewPosition(49, id, 0, 20, 20);
       //     System.Threading.Thread.Sleep(5);
      //      c.InsertNewPosition(49, id, 0, 10, 10);

//            Console.WriteLine(id);



            //List<hh> ll = new List<hh>();
            //ll.Add(new hh(47.4857F, 19.069938F));
            //ll.Add(new hh(47.485988F, 19.070098F));
            //ll.Add(new hh(47.486177F, 19.070164F));
            //ll.Add(new hh(47.486518F, 19.070244F));
            //ll.Add(new hh(47.496251F, 19.070805F));


            //foreach (var item in ll)
            //{
            //    c.InsertNewPosition(6, id, 0, item.Lat, item.Lon);
            //    System.Threading.Thread.Sleep(1000);
            //}
            //ServiceReference1.StationListItem rr = c.getNearestVehicleStation(49, 11, 11);

            //Console.WriteLine(String.Format("lat: {0}, long: {1}, name: {2}, number: {3}", rr.Latitude, rr.Longiture, rr.StationName, rr.Snumber));


            //ServiceReference1.Position[] pos = c.getAllVehiclePositions();

            //foreach (var item in pos)
            //{
            //    Console.WriteLine(String.Format("Vnumber {0}, lat: {1}, lon: {2}", item.VehicleNumber, item.Latitude, item.Longitude));
            //}

            //Console.WriteLine(c.getTimeFromStation(6, 48, 20));

            //DateTime t1 = DateTime.Now;

            //System.Threading.Thread.Sleep(3000);

            //DateTime t2 = DateTime.Now;

            //Console.WriteLine(t2.Subtract(t1));

        //    ----------------------------------

            //List<hh> poss = new List<hh>();
            //string id = c.GetID(41.47723F, 16.04717F);


            //poss.Add(new hh(47.47723F, 19.04717F)); //Moricz
            //poss.Add(new hh(47.4766804F, 19.0509796F));

            //poss.Add(new hh(47.47583F, 19.05409F)); //Budafoki ut

            //poss.Add(new hh(47.4761147F, 19.05761F));

            //poss.Add(new hh(47.47694F, 19.05961F)); //Petofi hid

            //poss.Add(new hh(47.4783772F, 19.0623736F));

            //poss.Add(new hh(47.4794939F, 19.0645838F));

            //poss.Add(new hh(47.48035F, 19.06702F)); //Boraros

            //poss.Add(new hh(47.4813211F, 19.0678024F));


            //poss.Add(new hh(47.482118F, 19.068467F)); //Mester utva


            //poss.Add(new hh(47.4825393F, 19.0687895F));
            //poss.Add(new hh(47.4839314F, 19.0691972F));

            //poss.Add(new hh(47.48579F, 19.07015F));//Corvin negyed

            //poss.Add(new hh(47.4873535F, 19.0703559F));

            //poss.Add(new hh(47.4889485F, 19.0706134F));

            //poss.Add(new hh(47.48931F, 19.07139F)); //harminckettesek tere

            //poss.Add(new hh(47.4907029F, 19.0708709F));
            //poss.Add(new hh(47.4919498F, 19.0708923F));

            //poss.Add(new hh(47.49309F, 19.07193F)); //Rakoczi ter 

            //poss.Add(new hh(47.4940666F, 19.0709352F));
            //poss.Add(new hh(47.4956034F, 19.0706778F));


            //poss.Add(new hh(47.4963F, 19.06961F)); //Blaha

            //poss.Add(new hh(47.4983434F, 19.0700984F));
            //poss.Add(new hh(47.4993437F, 19.0695405F));

            //poss.Add(new hh(47.49977F, 19.06753F)); //Wesselenyi utca

            //poss.Add(new hh(47.5013152F, 19.0678239F));
            //poss.Add(new hh(47.5024314F, 19.0667295F));

            //poss.Add(new hh(47.50234F, 19.06343F)); //kiraly utca

            //poss.Add(new hh(47.5038955F, 19.0650558F));
            //poss.Add(new hh(47.5046348F, 19.0642405F));


            //poss.Add(new hh(47.50552F, 10.06369F)); //Oktogon

            //poss.Add(new hh(47.5064322F, 19.061687F));
            //poss.Add(new hh(47.5079251F, 19.0595627F));
            //poss.Add(new hh(47.5091426F, 19.0577602F));

            //poss.Add(new hh(47.50994F, 19.05664F)); //Nyugati

            //poss.Add(new hh(47.5112007F, 19.0536189F));
            //poss.Add(new hh(47.5121138F, 19.0511513F));
            //poss.Add(new hh(47.512824F, 19.0490913F));

            //poss.Add(new hh(47.51338F, 19.04683F)); //Jaszai Mari ter

            //poss.Add(new hh(47.5139979F, 19.0455723F));
            //poss.Add(new hh(47.514824F, 19.0432549F));
            //poss.Add(new hh(47.514708F, 19.0404224F));

            //poss.Add(new hh(47.51537F, 19.03951F)); //Margit hid, budai hidfo

            //poss.Add(new hh(47.5146211F, 19.0367746F));
            //poss.Add(new hh(47.5130993F, 19.0348649F));

            //poss.Add(new hh(47.51204F, 19.03303F)); //Mechwart liget

            //poss.Add(new hh(47.510679F, 19.0310454F));
            //poss.Add(new hh(47.5097224F, 19.0288138F));

            //poss.Add(new hh(47.50785F, 19.02678F)); //Szena ter

            //poss.Add(new hh(47.5078236F, 19.0262389F));

            //poss.Add(new hh(47.50694F, 19.0248F)); //Moszkva ter

            //foreach (var item in poss)
            //{
            //    Console.WriteLine(c.InsertNewPosition(6, id, item.Lat, item.Lon));
            //    System.Threading.Thread.Sleep(2000);
            //}

           // int time = c.getTimeFromStation(6,"V" ,47.50785F, 19.02678F);

            string mid = c.GetID(47.50785F, 19.02678F);
            Console.WriteLine(mid);

           c.InsertNewPosition(6, "V", mid, 4.50785F, 1.02678F);

         
         //   System.Threading.Thread.Sleep(2000);


            string mid2 = c.GetID(47.50785F, 19.02678F);
            Console.WriteLine(mid2);

           // Console.WriteLine(time);


            Console.ReadKey();          
        }
    }
}
